package com.yxx.mapper;

import com.github.pagehelper.Page;
import com.yxx.medicinepojo.dto.OrdersPageQueryDTO;
import com.yxx.medicinepojo.entity.OrderDetail;
import com.yxx.medicinepojo.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author yuxiangxun
 * @date 2024/9/16
 * @apiNote
 */
@Mapper
public interface OrderDetailMapper {
    /**
     * 根据订单id查询订单明细
     * @param id
     * @return
     */
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> geOrderDetailtByOrderId(Long id);

    /**
     * 根据订单id查询订单明细（集合）
     * @param orderById
     * @return
     */
    @Select("select * from order_detail where order_id = #{orderById}")
    List<OrderDetail> getByOrderId(Long orderById);

    /**
     * 将订单详情信息批量插入到订单详情表中
     * @param orderDetailList
     */
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
     * 历史订单分页查询
     * @param ordersPageQueryDTO
     * @return
     */
    Page<Orders> orderDetailPageQuery(OrdersPageQueryDTO ordersPageQueryDTO);
}
